package com.wuxiaolong.service;

import com.wuxiaolong.framework.annotation.Autowired;
import com.wuxiaolong.framework.annotation.Component;
import com.wuxiaolong.framework.service.BeanNameAware;
import com.wuxiaolong.framework.service.InitializingBean;

/**
 * Description:
 *
 * @author 诸葛小猿
 * @date 2020-11-19
 */
@Component("userService")
public class UserService implements BeanNameAware, InitializingBean {

    @Autowired
    private OrderService orderService;

    public void test(){
        System.out.println("orderService:"+ orderService);

        System.out.println("currentBeanName:"+ currentBeanName);
    }



    /**
     * 当前bean的名字： userService
     */
    private String currentBeanName;

    public void setBeanName(String name) {
        this.currentBeanName = name;
    }


    /**
     * 初始化完成后，可以验证相关的属性
     */
    public void afterPropertiesSet() {
        if(orderService == null){
            throw new RuntimeException("");
        }
    }


}
